<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>题目详情 - {$question.title}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__CDN__/assets/libs/bootstrap/css/bootstrap.min.css">
    <style>
        body {
            background-color: #f8f9fa;
            font-family: 'Microsoft YaHei', Arial, sans-serif;
        }
        .question-container {
            max-width: 1000px;
            margin: 20px auto;
            padding: 0 15px;
        }
        .question-card {
            background: #fff;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            margin-bottom: 20px;
            overflow: hidden;
        }
        .question-header {
            background: linear-gradient(135deg, #007bff, #0056b3);
            color: white;
            padding: 25px;
        }
        .question-title {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 15px;
            line-height: 1.4;
        }
        .question-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            font-size: 14px;
            opacity: 0.9;
        }
        .meta-item {
            display: flex;
            align-items: center;
            gap: 5px;
        }
        .question-content {
            padding: 30px;
        }
        .question-ask {
            font-size: 18px;
            font-weight: 500;
            color: #333;
            margin-bottom: 25px;
            line-height: 1.6;
        }
        .answer-options {
            margin-bottom: 30px;
        }
        .option-item {
            background: #f8f9fa;
            border: 2px solid #e9ecef;
            border-radius: 8px;
            padding: 15px 20px;
            margin-bottom: 12px;
            transition: all 0.3s ease;
            cursor: pointer;
        }
        .option-item:hover {
            border-color: #007bff;
            background: #e3f2fd;
        }
        .option-item.correct {
            background: #d4edda;
            border-color: #28a745;
            color: #155724;
        }
        .option-label {
            font-weight: bold;
            margin-right: 10px;
            color: #007bff;
        }
        .correct .option-label {
            color: #28a745;
        }
        .explanation-section {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 25px;
            margin-top: 20px;
        }
        .explanation-title {
            font-size: 16px;
            font-weight: bold;
            color: #333;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .explanation-content {
            color: #555;
            line-height: 1.6;
        }
        .related-questions {
            background: #fff;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            padding: 25px;
        }
        .related-title {
            font-size: 18px;
            font-weight: bold;
            color: #333;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid #007bff;
        }
        .related-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 0;
            border-bottom: 1px solid #eee;
            transition: background 0.3s ease;
        }
        .related-item:hover {
            background: #f8f9fa;
            border-radius: 6px;
            padding-left: 10px;
            padding-right: 10px;
        }
        .related-item:last-child {
            border-bottom: none;
        }
        .related-question-title {
            flex: 1;
            color: #333;
            text-decoration: none;
            font-weight: 500;
        }
        .related-question-title:hover {
            color: #007bff;
            text-decoration: none;
        }
        .question-type-badge {
            background: #007bff;
            color: white;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 500;
        }
        .back-btn {
            background: #6c757d;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 6px;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 20px;
            transition: background 0.3s ease;
        }
        .back-btn:hover {
            background: #5a6268;
            color: white;
            text-decoration: none;
        }
        @media (max-width: 768px) {
            .question-meta {
                flex-direction: column;
                gap: 10px;
            }
            .question-content {
                padding: 20px;
            }
            .related-item {
                flex-direction: column;
                align-items: flex-start;
                gap: 10px;
            }
        }
    </style>
</head>
<body>
    <div class="question-container">
        <a href="javascript:history.back()" class="back-btn">
            <i class="fa fa-arrow-left"></i>
            返回上一页
        </a>
        
        <div class="question-card">
            <div class="question-header">
                <div class="question-title">{$question.title}</div>
                <div class="question-meta">
                    <div class="meta-item">
                        <strong>课程：</strong>
                        <span>{$question.course_name}</span>
                        {if $question.course_code}
                        <span style="opacity: 0.8;">({$question.course_code})</span>
                        {/if}
                    </div>
                    <div class="meta-item">
                        <strong>考试类型：</strong>
                        <span>{$question.exam_name}</span>
                    </div>
                    <div class="meta-item">
                        <strong>题目类型：</strong>
                        <span>{$question.type}</span>
                    </div>
                    <div class="meta-item">
                        <strong>收费类型：</strong>
                        <span>{$question.charge_type}</span>
                    </div>
                    <div class="meta-item">
                        <strong>上传时间：</strong>
                        <span>{$question.upload_time}</span>
                    </div>
                </div>
            </div>
            
            <div class="question-content">
                <div class="question-ask">
                    {$question.question_ask|raw}
                </div>
                
                {if $question.answer_options}
                <div class="answer-options">
                    {volist name="question.answer_options" id="option" key="key"}
                    {if $option}
                    <div class="option-item {if $key == $question.correct_option}correct{/if}">
                        <span class="option-label">{$key}.</span>
                        <span>{$option|raw}</span>
                        {if $key == $question.correct_option}
                        <span style="float: right; color: #28a745; font-weight: bold;">✓ 正确答案</span>
                        {/if}
                    </div>
                    {/if}
                    {/volist}
                </div>
                {/if}
                
                {if $question.explanation}
                <div class="explanation-section">
                    <div class="explanation-title">
                        <i class="fa fa-lightbulb-o" style="color: #ffc107;"></i>
                        详细解析
                    </div>
                    <div class="explanation-content">
                        {$question.explanation|raw}
                    </div>
                </div>
                {/if}
            </div>
        </div>
        
        {if $relatedQuestions}
        <div class="related-questions">
            <div class="related-title">相关题目推荐</div>
            {volist name="relatedQuestions" id="related"}
            <div class="related-item">
                <a href="{:url('question/detail', ['id' => $related.id])}" class="related-question-title">
                    {$related.title}
                </a>
                <span class="question-type-badge">{$related.type}</span>
            </div>
            {/volist}
        </div>
        {/if}
    </div>
    
    <script src="__CDN__/assets/libs/jquery/jquery.min.js"></script>
    <script src="__CDN__/assets/libs/bootstrap/js/bootstrap.min.js"></script>
    <script>
        $(document).ready(function() {
            // 选项点击效果
            $('.option-item').click(function() {
                $('.option-item').removeClass('selected');
                $(this).addClass('selected');
            });
        });
    </script>
</body>
</html>